package org.example.domain.strategy.repository;

import org.example.domain.strategy.model.entity.StrategyAwardEntity;
import org.example.domain.strategy.model.entity.StrategyEntity;
import org.example.domain.strategy.model.entity.StrategyRuleEntity;
import org.example.domain.strategy.model.vo.RuleTreeVO;
import org.example.domain.strategy.model.vo.StrategyAwardRuleModelVO;
import org.example.domain.strategy.model.vo.StrategyAwardStockKeyVO;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 领域层仓储接口
 * -----不包含实现细节 只定义行为
 */

public interface IStrategyRepository {

    List<StrategyAwardEntity> queryStrategyAwardList(Long strategyId);

    void storeStrategyAwardSearchRateTable(String key, Integer rateRange, Map<Integer, Integer> shuffleStrategyAwardSearchRateTable);

    int getrateRange(Long strategyId);

    int getrateRange(String key);

    Integer getStrategyAward(String key, int rateKey);

    StrategyEntity getStrategyEntity(Long strategyId);

    StrategyRuleEntity queryStrategyRule(Long strategyId, String ruleModel);

    String queryRuleValue(Long strategyId, Integer awardId, String ruleModel);

    String queryStrategyRulvValue(Integer awardId, Long strategyId, String ruleModel);

    StrategyEntity queryStrategy(Long strategyId);

    StrategyAwardRuleModelVO queryRuleModedls(Long strategyId, Integer awardId);

    String queryRuleValueModel(Long strategyId, String ruleModel);


    String queryStrategyRulvValueWithoutAwarId(String ruleModel, Long strategyId);

    StrategyEntity queryStrategyEntityByStrategyId(Long strategyId);

    String queryStrategyRulvValueWithoutAwarIdtwo(String ruleModel, Long strategyId);

    int getRateRange(Long strategyId);

    Integer getStrategyAwardAssemble(String key, Integer rateKey);

    int getRateRange(String key);

    int getRateRange1(String key);

    RuleTreeVO queryRuleTreeByTreeId(String treeId);

    RuleTreeVO queryRuleTreeByTreeIdByMyself(String treeId);

    StrategyAwardRuleModelVO queryRuleModels(Long strategyId, Integer awardId);

    void cacheAwardCount(String cacheKey, Integer awardCount);

    boolean substractionAwardStock(String key);

    void awardStockConsumeSendQueue(StrategyAwardStockKeyVO strategyAwardStockKeyVO);

    StrategyAwardStockKeyVO takeQueue() throws InterruptedException;

    void updateStrategyAwardStockKey(Long strategyId, Integer awardId);
}
